<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>菜品类别编辑</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <i th:replace="~{common :: baseUrl}"></i>
</head>
<body>
<form class="layui-form layui-form-pane" action=""  lay-filter="example">


    <div class="container">
        <div class="row clearfix">
            <div class="col-md-6 column">

                <div class="layui-form-item">
                    <label class="layui-form-label">套餐编号</label>
                    <div class="layui-input-inline">
                        <input type="text" id="id"readonly name="id" lay-verify="required" th:value="${promotionMealHot.id}" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">套餐名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="mealName"  readonly th:value="${promotionMealHot.mealName}" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">套餐类别</label>
                    <div class="layui-input-inline">
                        <select name="categoryId" id="categoryId" disabled lay-filter="categoryId"  >
                            <option value=''>请选择菜品类别</option>
                            <option th:each="f : ${promotionMealHotCategoryList}"  th:value="${f.id}" th:text="${f.name}" th:selected="${promotionMealHot.categoryId eq f.id}"></option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">价格</label>
                    <div class="layui-input-inline">
                        <input type="text" name="priceString" readonly  th:value="${promotionMealHot.priceString}" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">门店</label>
                    <div class="layui-input-inline">
                        <select name="merchantsId" id="merchantsId" disabled  >
                            <option value=''>请选择菜品类别</option>
                            <option th:each="f : ${merchantsInformationList}"  th:value="${f.id}" th:text="${f.name}" th:selected="${promotionMealHot.merchantsId eq f.id}"></option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-inline">
                        <input type="text" name="orders" readonly  th:value="${promotionMealHot.orders}" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>




            </div>
            <div class="col-md-6 column">

                <div class="layui-form-item">

                    <div class="layui-inline">
                        <label class="layui-form-label">上传图片</label>
                        <div class="layui-input-inline">
                            <div class="layui-upload">

                                <div class="layui-upload-list">
                                    <input hidden name="picPath" id="picPath" th:value="${promotionMealHot.picPath}">
                                    <img width="100px" height="100px" class="layui-upload-img" name="showPic" id="showPic" th:src="${promotionMealHot.picPath}">
                                    <p id="uploadText"></p>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">商品状态</label>
                    <div class="layui-input-block">
                        <input type="checkbox" disabled th:checked="${promotionMealHot.status == 1}"  name="status" value="1" lay-skin="switch"  lay-text="上架|下架">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">打印标签</label>
                    <div class="layui-input-block">
                        <input type="checkbox" disabled th:checked="${promotionMealHot.printLabel == 1}"  name="printLabel" value="1" lay-skin="switch" lay-text="开启|关闭">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手动打折</label>
                    <div class="layui-input-block">
                        <input type="checkbox" disabled th:checked="${promotionMealHot.manualDiscount == 1}"  name="manualDiscount" value="1" lay-skin="switch" lay-text="开启|关闭">
                    </div>
                </div>

            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">说明</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" readonly name="explains" th:text="${promotionMealHot.explains}" class="layui-textarea"></textarea>
                </div>
            </div>


            <!--展示数据-->
            <div>

                <table class="layui-hide" id="mealHot" lay-filter="mealHot" ></table>

            </div>





        </div>
    </div>








    <div class="layui-form-item" align="center">
        <div class="layui-input-block">
            <button type="button" id="cancel" class="layui-btn ">返回</button>

        </div>
    </div>

</form>



</body>
<script th:src="@{/layui/layui.js}"></script>
<script th:inline="none">
    //JavaScript代码区域
    layui.use(['element','form','upload','layer','table'], function() {
        var element = layui.element;
        var form = layui.form;
        var upload = layui.upload;
        var layer = layui.layer;
        var table = layui.table;
        var $ = layui.$;



        //表格初始化
        table.render({
            elem: '#mealHot'
            ,url:baseUrl+'promotion/mealHot/recordList'
            ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            ,width: 950
            ,totalRow: true
            ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
            ,cols: [[
                {field:'recordId', width:145, title: '编号'}
                ,{field:'id', width:80, title: 'ID',hide:true}
                ,{field:'recordName', width:150, title: '菜品名称', totalRowText: '合计' }
                ,{field:'priceString', width:150, title: '售价' }
                ,{field:'recordNum', width:150, title: '数量' }
                ,{field:'totalPriceString', width:150, title: '小计' ,totalRow: true}
                ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:195}
            ]]
            ,where: {
                id:$("#id").val()


            } //设定异步数据接口的额外参数

        });





        //取消
        $("#cancel").click(function (){
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭


        });







    });

</script>
</html>